-
July 28th, 2026, 06:03 AM
#1
Senior Hostboard Member
How do I use a random number helper in an automation
Hello all,
I have a light entity in home assistant that ranges from 1-255 (I have created a random number helper for this range). I am trying to create an automation that whenever presence is detected in the room, it uses the random number generated from the helper and sets the light entity at that value. This is my current YAML:
device_id: xxxxxxxxx
domain: number
entity_id: yyyyyyyyy
type: set_value
value: "{{ states('sensor.bedroom_light_switch_random_number') | float(0) }}"
I feel like I have tried every option under the sun but I continue to get the same, “Message malformed: expected float for dictionary value @ data[‘value’]” error message. I have tested the value line within the template section of the developer tools and it returns the appropriate value. Does anyone have an idea on how to fix this?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks